<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class DL_Controller extends Devlism{
    protected $controller_path = 'controllers/'; //with trailing slash
    protected $module;
    protected $controller;
    protected $action;
    protected $params=array();
    
    function set_controller($controller,$folder_controller,$vars=array())
    {
	$this->controller_path = $controller['folder'];
	$this->module = $controller['module'];
	$this->controller_folder = $folder_controller;
	$this->controller = $controller['class'];
	$this->action = $controller['method'];
	$this->params = $vars;
    }
    
    function run_controller()
    {
	if(method_exists($this , $this->action)){
	//if (is_callable(array($this, $this->action))){
	    $class = mb_convert_case("{$this->controller}_controller", MB_CASE_TITLE, "UTF-8");
	    call_user_func_array(array($class, $this->action), $this->params);
	}else{
	    $this->error("Error : Method {$this->action} in {$this->controller_path}/{$this->controller_folder}/{$this->controller}_controller.php does not exist!");
	}
    }
}

/* End of file DL_Controller.class.php */
/* Location: ./core/DL_Controller.class.php */